' πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅
' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.10.26.02.14]) on 2023.11.01 at 02:28 (Coordinated Universal Time)
' Program by Charlie Veniot
' πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅

'🟠🟠🟠 Declarations 🟠🟠🟠

DECLARE SUB πŸ‘»PrintGhost(x%,y%) 

ghostWidth% = 14
ghostHeight% = 14

ghostBod$ = _
  ".....XXXX....." + _
  "...XXXXXXXX..." + _
  "..XXXXXXXXXX.." + _
  ".XXXXXXXXXXXX." + _
  ".XXXXXXXXXXXX." + _
  ".XXXXXXXXXXXX." + _
  "XXXXXXXXXXXXXX" + _
  "XXXXXXXXXXXXXX" + _
  "XXXXXXXXXXXXXX" + _
  "XXXXXXXXXXXXXX" + _
  "XXXXXXXXXXXXXX" + _
  "XXXXXXXXXXXXXX" + _
  "XX.XXX..XXX.XX" + _
  "X...XX..XX...X"
  
ghostEyeballLeft$ = _
  ".............." + _
  ".............." + _
  ".............." + _
  "..XX....XX...." + _
  ".XXXX..XXXX..." + _
  "...XX....XX..." + _
  "...XX....XX..." + _
  "..XX....XX...." + STRING$(6*14,".")
  
ghostEyeballRight$ = _
  ".............." + _
  ".............." + _
  ".............." + _
  "....XX....XX.." + _
  "...XXXX..XXXX." + _
  "...XX....XX..." + _
  "...XX....XX..." + _
  "....XX....XX.." + STRING$(6*14,".")
  
ghostIrisLeft$ = _
  ".............." + _
  ".............." + _
  ".............." + _
  ".............." + _
  ".............." + _
  ".XX....XX....." + _
  ".XX....XX....." + STRING$(7*14,".")
  
ghostIrisRight$ = _
  ".............." + _
  ".............." + _
  ".............." + _
  ".............." + _
  ".............." + _
  ".....XX....XX." + _
  ".....XX....XX." + STRING$(7*14,".")

'🟠🟠🟠 🏁🏁🏁 Main Program 🏁🏁🏁 🟠🟠🟠 
  
  SCREEN _NEWIMAGE(300,100,12)
  _ALERT("Click/touch the screen to pause the program.")
  loopCount% = 1
  βž”another_ghost:
      IF loopCount% MOD 3 = 0 THEN _
          πŸ‘»PrintGhost( _  
              INT(RND*(100)), _ 
              INT(RND*(_HEIGHT-ghostHeight%)) )
      _DELAY 0.025
      IF _MOUSEBUTTON THEN WHILE _MOUSEBUTTON : WEND
      SCROLL 1,0,FALSE
      loopCount% += 1
  GOTO βž”another_ghost
  END
  
'🟠🟠🟠 Subroutines 🟠🟠🟠

SUB πŸ‘»PrintGhost(x%,y%) 
    bodyColor% = INT(RND*14)+1
    eyeDirection% = INT(RND*2)
    ghostEyeball$ = IFF(eyeDirection%,ghostEyeballLeft$,ghostEyeballRight$)
    ghostIris$ = IFF(eyeDirection%,ghostIrisLeft$,ghostIrisRight$)
    irisColor% = IFF(INT(RND*2), 1, 6)
    FOR thisY = 1 TO ghostHeight%
        FOR thisX = 1 TO ghostWidth%
            IF MID$(ghostBod$, (thisY-1) * ghostWidth% + thisX, 1) <> "." THEN PSET (x% + thisX - 1, y% + thisY - 1), bodyColor%
            IF MID$(ghostEyeball$, (thisY-1) * ghostWidth% + thisX, 1) <> "." THEN PSET (x% + thisX - 1, y% + thisY - 1), 15
            IF MID$(ghostIris$, (thisY-1) * ghostWidth% + thisX, 1) <> "." THEN PSET (x% + thisX - 1, y% + thisY - 1), irisColor%
        NEXT thisX
    NEXT thisY
END SUB